<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>首布局页面</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/main.css" />
</head>
<body>
  <footer></footer>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
apiready=function(){
  // console.log("main"+$api.getStorage('jwt'))
  // console.log("main"+$api.getStorage('aid'))
  var fale=api.pageParam.fale; //文章的id
  //打开三个布局
  api.openFrameGroup({
      name: 'layout',
      scrollEnabled:false,
      preload:2,
      rect: {
          x: 0,
          y: 0,
          w: 'auto',
          h: api.winHeight-57
      },
      frames: [{
          name: 'frame1',
          url: 'home.html',
          bgColor: '#fff'
      }, {
          name: 'frame2',
          url: 'job.html',
          bgColor: '#fff'
      }
      //兄弟你的页面炸了
      , {
          name: 'frame3',
          url: 'colleague.html',
          bgColor: '#fff'
      }
    ]
  }, function(ret, err) {
      var index = ret.index;
  });
  //底部导航
  var MNNavigationMenu = api.require('MNNavigationMenu');
  MNNavigationMenu.open({
      rect: {
          x: 0,
          y: api.winHeight-56,
          w: api.winWidth,
          h: 56
      },
      index: 0,
      animation: true,
      styles: {
          column: 3,
          bg: '#f7f7f7',
          item: {
              bg: 'rgba(247,247,247,0.7)',
              title: {
                  marginB: 4,
                  size: 14,
                  height: 14,
                  color: '#838c94',
                  active: '#37acfe',
                  highlight: '#37acfe',
                  ttf:'Alkatip Basma Tom'
              },
              icon: {
                  marginT: 3,
                  width: 32,
                  height: 32,
                  corner: 2
              }
          }
      },
      items: [{
          title: '首页',
          icon: 'widget://image/home.png',
          active: 'widget://image/homes.png'
      }, {
          title: '学习论坛',
          icon: 'widget://image/essay.png',
          active: 'widget://image/essays.png'
      }, {
          title: '我的大学',
          icon: 'widget://image/mycolleague.png',
          active: 'widget://image/mycolleagues.png'
      }],
      fixedOn: api.frameName,
      fixed: false
  }, function(ret, err) {
      if (ret) {
          //切换frame
          if(ret.index==0){
            api.setFrameGroupIndex({
      			    name: 'layout',
      			    index: 0
      			});
            api.setFrameAttr({
                name: 'home_frame',
                hidden: false
            });
          }
          if(ret.index==1){
            api.setFrameGroupIndex({
      			    name: 'layout',
      			    index: 1
      			});
            api.setFrameAttr({
                name: 'home_frame',
                hidden: true
            });
          }
          if(ret.index==2){
            api.setFrameGroupIndex({
      			    name: 'layout',
      			    index: 2
      			});
            api.setFrameAttr({
                name: 'home_frame',
                hidden: true
            });
          }
      } else {
          alert(JSON.stringify(err));
      }
  });
//----------------------------------------------------------------------------
if(fale){
    api.setFrameGroupIndex({
                name: 'layout',
                index: 1
            });
    MNNavigationMenu.setIndex({
        index: 1
    }, function(ret, err) {
        if (ret) {
            //alert(JSON.stringify(ret));
        } else {
            alert(JSON.stringify(err));
        }
    });
}

}//apiready=function(){ 函数的反括号
</script>
</html>
